package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.domain.Book;
import com.itheima.mapper.Hellomapper;
import com.itheima.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(interfaceClass = HelloService.class,protocol = "dubbo") //发布服务必须使用Dubbo提供的Service注解
@Transactional
public class HelloServiceImpl implements HelloService {

    @Autowired
    private Hellomapper hellomapper;

    @Override
    public String sayHello() {
        System.out.println(321);
        return "8085 hello " ;
    }

    @Override
    public List<Book> findAll(){
        List<Book> bookList = hellomapper.findAll();
        return bookList;
    }

    @Override
    public void update(Book book) {
        System.out.println("码云");
        hellomapper.update(book);
    }
}
